package platformer.controller.collisions;

/**
 * The Class CollisionDictionaryKey.
 */
class PlatformerCollisionDictionaryKey extends Object{
	
	/** The collisioner category. */
	PlatformerCollisionCategory	colliderCategory;
	
	/** The collisionee category. */
	PlatformerCollisionCategory 	collidedCategory;
	
	/**
	 * Instantiates a new collision dictionary key.
	 *
	 * @param colliderCategory the collider category
	 * @param collidedCategory the collided category
	 */
	public PlatformerCollisionDictionaryKey(
			PlatformerCollisionCategory	colliderCategory, 
			PlatformerCollisionCategory collidedCategory
	) {
		this.colliderCategory = colliderCategory;
		this.collidedCategory = collidedCategory;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((collidedCategory == null) ? 0 : collidedCategory.hashCode());
		result = prime
				* result
				+ ((colliderCategory == null) ? 0 : colliderCategory.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PlatformerCollisionDictionaryKey other = (PlatformerCollisionDictionaryKey) obj;
		if (collidedCategory != other.collidedCategory)
			return false;
		if (colliderCategory != other.colliderCategory)
			return false;
		return true;
	}

}